package com.rmondjone.view

import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.bumptech.glide.Glide
import com.rmondjone.androidcamerademo.R
import com.rmondjone.utils.setClickListener
import kotlinx.android.synthetic.main.dialog_notify.*

/**
 * copyright：
 * @author：anthui creation date： .
 * @since: 1.0.0
 * @describe:
 */
class NotifyDialog : BaseDialog() {

//    lateinit var mProgression: ProgressBar


    var list = arrayListOf<String>()

    lateinit var imageAdapter: ImageAdapter
    override fun initComponents() {
        recyclerview.apply {

            layoutManager = LinearLayoutManager(mActivity)
            imageAdapter = ImageAdapter()
            adapter = imageAdapter

        }

        list.let {
            iv_pic.visibility = View.GONE
            if (list.size == 1) {
                list.firstOrNull()?.let {
                    Glide.with(mContext).load(it).into(iv_pic)
                    iv_pic.visibility = View.VISIBLE
                }
                return
            }
            imageAdapter.setNewData(list)
        }


    }


    override fun initData() {

        layout_click.setClickListener {
            dismiss()
        }

        home_click.setClickListener {  }
        iv_back.setClickListener { dismiss() }

    }

    override fun getMainContentViewId(): Int {
        setOutCancel(true)

        return R.layout.dialog_notify

    }

}